

<%= image_tag("icons/spinner.gif",
              :align => "absmiddle",
              :border => 0,
              :id => "spinner",
              :style =>"display: none;" ) %>

<div id="table">
  <h1>Administration</h1>
  <div class="intro-cartasur">
    <h3>Objectives</h3>
    This is the adminstration page for objectives.
  </div>
  <table cellpadding="5" cellspacing="10">
    <th align="center" colspan="2"></th>
        <tr>
          <td aligh="right">Create a new objective: </td>
          <td><%= link_to("New objective" , new_cartasur_objective_path) %></td>
        </tr>
  </table>
</div>

<hr/>


<h3>All objectives</h3>
<%= will_paginate @cobjectives  %>
<table cellpadding="5" cellspacing="10"  id="zebra-rows">
  <th>Time range(Hours) </th>
  <th>Months </th>
  <th>Days </th>
  <th>Location </th>
  <th></th>
   <% count = 0 #for highlighting rows %>
  <% @cobjectives.each do |objective| %>
      <tr <%= "class=odd" if count.odd? %>>
        <td><%= objective.time_range %></td><td><%= objective.months %></td>
        <td> <%= objective.days %> </td><td> <%= objective.location_name %> </td>
        <td> <%=  link_to("Edit" , edit_cartasur_objective_path(objective)) %> | <%=  link_to("Users" ,showusers_cartasur_objective_path(objective)) %></td>
      </tr>
      <% count = count + 1 %>
  <% end %>

</table>

<br/>
<hr />
<h3>All Users</h3>

<%= will_paginate @cusers  %>
<br/>
<table cellpadding="5" cellspacing="10">
  <% @cusers.each do |user| %>

      <tr>
        <td aligh="right">User: <%= link_to user.login, edit_cartasur_user_path(user) %> | Email: <%=  user.email %></td>
        <!-- <td>Objectives <%= link_to("See objectives" , cartasur_objective_path(user)) %></td> -->
      </tr>

  <% end %>

</table>